package com.test.threadtest;

import java.util.concurrent.CountDownLatch;

/**
 * Created by jl on 2016/8/7.
 */
public class Demo {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch latch = new CountDownLatch(2);//两个人协作
        Worker worker1 = new Worker("Mike", 5000, latch);
        Worker worker2 = new Worker("Jack", 8000, latch);
        worker1.start();
        worker2.start();
        latch.await();
        System.out.println("所有工程完成在" + System.currentTimeMillis());
    }
}
